const koa = require('koa')
const bodyparser = require('koa-bodyparser')
const jsonerror = require('koa-json-error')
const parameter = require('koa-parameter')
const cors = require('koa-cors')
const app = new koa()

const MongoDBConnect = require('./db')

// 路由
const { userRouter, fileRouter } = require('./routes')

// 连接
MongoDBConnect()

app.use(cors())
app.use(jsonerror())
app.use(bodyparser())
app.use(parameter(app))
app.use(userRouter.routes())
app.use(fileRouter.routes())


app.listen(3008)
